import { TOKEN_TIME, TOKEN_EXPIRE_TIME } from '@/constant'
import { setItem, getItem } from './storage'

export const getTokenTime = () => {
  return getItem(TOKEN_TIME)
}

export const setTokenTime = () => {
  setItem(TOKEN_TIME, Date.now())
}

export const isCheckTimeOut = () => {
  const currentTime = Date.now()
  const timestamp = getTokenTime()
  return currentTime - timestamp > TOKEN_EXPIRE_TIME
}
